package com.turing.post.salesmanage.util;

import java.math.BigInteger;
import java.util.Date;
import java.util.List;

import javax.ejb.Local;
import javax.ejb.Remote;

import com.turing.post.util.PCPSApplicationException;

/**
 * 销售单付款信息业务接口
 * 
 * @author zxp
 * @Dec 23, 2012
 */
@Remote
@Local
public interface SaleOrderPaidDetailDao {
	/**
	 * 根据销售单付款信息主键编号查询销售单付款信息
	 * 
	 * @param saleOrderPaidId
	 *            销售单付款信息
	 * @return 销售单付款信息
	 */
	public SaleOrderPaidDetail getSaleOrderPaidDetailBySaleOrderPaidId(
			BigInteger saleOrderPaidId);

	/**
	 * 修改锁定记录
	 * 
	 * @param saleOrderPaidId
	 * @return
	 */
	public SaleOrderPaidDetail getSaleOrderPaidDetailForUpdate(
			BigInteger saleOrderPaidId);

	/**
	 * 根据销售单编号查询其所有付款明细
	 * 
	 * @param saleOrderId
	 * @return
	 */
	public List<SaleOrderPaidDetail> getSaleOrderPaidDetailListBySaleOrderId(
			BigInteger saleOrderId);

	/**
	 * 分页销售单付款查询
	 * 
	 * @param saleOrderId
	 *            销售单编号
	 * @param paidType
	 *            支付类型
	 * @param startTranTime
	 *            起始支付时间
	 * @param endTranTime
	 *            终止支付时间
	 * @param startPaidAmount
	 *            起始支付金额
	 * @param endPaidAmount
	 *            终止支付金额
	 * @param page
	 *            页码
	 * @return 销售单付款信息列表
	 */
	public List<SaleOrderPaidDetail> getSaleOrderPaidDetailListByCondition(
			BigInteger saleOrderId, String paidType, String startTranTime,
			String endTranTime, BigInteger startPaidAmount,
			BigInteger endPaidAmount, String paidClass, Integer page);

	/**
	 * 销售单付款查询记录数
	 * 
	 * @param saleOrderId
	 *            销售单编号
	 * @param paidType
	 *            支付类型
	 * @param startTranTime
	 *            起始支付时间
	 * @param endTranTime
	 *            终止支付时间
	 * @param startPaidAmount
	 *            起始支付金额
	 * @param endPaidAmount
	 *            终止支付金额
	 * @return 记录数
	 */
	public BigInteger getSaleOrderPaidDetailTotalByCondition(
			BigInteger saleOrderId, String paidType, String startTranTime,
			String endTranTime, BigInteger startPaidAmount,
			BigInteger endPaidAmount, String paidClass);

	/**
	 * 新增
	 * 
	 * @param saleOrderRealNameDetail
	 * @throws PCPSApplicationException
	 */
	public void insertSaleOrderPaidDetail(
			SaleOrderPaidDetail saleOrderPaidDetail)
			throws PCPSApplicationException;

	/**
	 * 修改
	 * 
	 * @param SaleOrderPaidDetail
	 * @throws PCPSApplicationException
	 */
	public void updateSaleOrderPaidDetail(
			SaleOrderPaidDetail saleOrderPaidDetail)
			throws PCPSApplicationException;

	/**
	 * 产生某销售机构某日销售业务日结数据
	 * 
	 * @param saleBranchNo
	 * @param tranDate
	 * @return
	 */
	public List<BranchDaySett_Obj> getBranchDaySettByBranchNoAndTranDate(
			String saleBranchNo, Date tranDate);

	/**
	 * 根据销售单号查询此销售单已经付款(销售款或手续费)的金额总和
	 * 
	 * @param saleOrderId
	 * @param paidClass
	 * @return
	 */
	public BigInteger getAlreayPaidAmountBySaleOrderId(BigInteger saleOrderId,
			String paidClass);

}
